local args = {KEYS[1],ARGV[1],ARGV[2],ARGV[3],ARGV[4]}
local records = redis.call('LRANGE',args[1],args[2],args[3])
local arg_up = args[4]
local arg_price = string.match(args[5],'(%d+.+%d+)')
local result={}
for k,v in pairs(records) do
	local status = string.sub(v,2,2)
	if(status == '0') then
		local up = string.sub(v,4,4)
		local _,_e = string.find(v,'|')
		local price = string.sub(v,6,_e-1)
		if(arg_up == up) then
			if((up == '1' and arg_price > price) or (up == '0' and arg_price < price)) then
				local newValue = '\"1'..string.sub(v,3)
				table.insert(result,newValue)
			end
		end
	end
end
return result
